﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace H_GAME
{
    public partial class frmConfigSet : Form
    {


        public frmConfigSet()
        {
            InitializeComponent();
            cboHardLevel.SelectedIndex = 4;
            cboPlayerChoose.SelectedIndex = 0;
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            fmrMain.Player = cboPlayerChoose.Text;
            fmrMain.CpuHardLevel = Convert.ToInt16(cboHardLevel.Text);
            fmrMain.CpuCount = Convert.ToInt16(numericUpDown1.Value);
            fmrMain.HelpCpuCount =1+ Convert.ToInt16(numericUpDown2.Value);
            fmrMain.Silder_Cpu = Convert.ToInt16(numericUpDown_CpuSoldier.Value);
            fmrMain.Silder_Plyer = Convert.ToInt16(numericUpDownPlyer.Value);
            if (chkAuto.Checked)
            {
                fmrMain.PlayerAuto = true;
            }
            else
            {
                fmrMain.PlayerAuto = false;
            }

            if (chkDevModel.Checked)
            {
                fmrMain.IsDevModel = true;
            }
            else
            { fmrMain.IsDevModel = false; }
            fmrMain.CloseFlag = true;
            this.Close();
            
        }

        private void frmConfigSet_Load(object sender, EventArgs e)
        {

        }

        private void cboPlayerChoose_SelectedIndexChanged(object sender, EventArgs e)
        {
            pictureBox1.Refresh();
        }

        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            Bitmap Headimg = new Bitmap(Application.StartupPath + "\\Pic\\Hammer" + cboPlayerChoose.Text + "\\S_1.png");
            Rectangle HeadOld = new Rectangle(0, 0, Headimg.Width, Headimg.Height);
            Rectangle HeadNew = new Rectangle(124, 73, 70, 60);
            e.Graphics.DrawImage(Headimg, 0, 0, HeadNew, GraphicsUnit.Pixel);
        }

        /// <summary>
        /// 动作编排测试
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            frmActionTest fc = new frmActionTest();
            fc.ShowDialog();
        }
    }
}
